package hotel.model;

import hotel.data.MD5Creator;
import hotel.entity.IEntity;

public class User implements IUser, IEntity
{
	private String username = null;
	private String password = null;
	private String name = null;
	private String surname = null;
	int id;
	boolean admin = false;
	private String MD5 = null;
	private String salt = "!@#$%^&@!";

	
	protected User(){}
	
	public User(String username, String password, String name, String surname, int id, boolean admin)
	{
		this.username = username;
		this.password = password;
		this.name = name;
		this.surname = surname;
		this.id = id;
		this.admin = admin;
		MD5 = MD5Creator.MD5(salt+username);
	}
	@Override
	public String getUsername() 
	{
		return username;
	}
	@Override
	public String getPassword() 
	{
		return password;
	}
	@Override
	public String getName() 
	{
		return name;
	}
	@Override
	public String getSurname() 
	{
		return surname;
	}
	@Override
	public int getId()
	{
		return id;
	}

	public boolean getAdmin() {
		return admin;
	}

	public void setMD5(String username) 
	{
		MD5 = MD5Creator.MD5(salt+username);
	}

	public String getMD5() {
		return MD5;
	}
}